package com.tuo51.foudation.constant;

import lombok.Setter;

/**
 * *******************************
 * Created by Ron.
 * form com.tuo51
 * on 2018/10/31
 * *******************************
 */
public class LiveRoomConstant {

    public static final int LIVEWAY_EZOPEN = 1;
    public static final int LIVEWAY_RTMP = 2;

    public enum Status{
        EXCEPTION(-1, "异常"),
        NON_START(0, "图片"),
        LIVING(1, "直播中"),
        OVER(2, "已过期"),
        STOP(3, "直播已暂停"),
        ;

        @Setter
        private int code;

        @Setter
        private String value;

        Status(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public Status get(int code){
            for (Status status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return null;
        }
    }

    public enum LiveWay{
        EXCEPTION(1, "EZOPEN"),
        NON_START(2, "RTMP");

        @Setter
        private int code;

        @Setter
        private String value;

        LiveWay(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf() {
            return value;
        }

        public static String get(int code) {
            for (LiveWay liveWay : values()) {
                if (liveWay.codeOf() == code)
                    return liveWay.valueOf();
            }
            return null;
        }
    }
}
